package com.mms.action.device;

import java.util.List;

import com.mms.dao.DeviceManagementDao;
import com.mms.entity.Device;
import com.opensymphony.xwork2.Action;

public class DeleteDeviceAction implements Action{

	private int startpage;
	private int DelID;
	private boolean delSuccess;
	private List<Device> deviceMessage;
	private int account;
	
	
	public int getStartpage() {
		return startpage;
	}


	public void setStartpage(int startpage) {
		this.startpage = startpage;
	}


	public int getDelID() {
		return DelID;
	}


	public void setDelID(int delID) {
		DelID = delID;
	}


	public boolean isDelSuccess() {
		return delSuccess;
	}


	public void setDelSuccess(boolean delSuccess) {
		this.delSuccess = delSuccess;
	}


	public List<Device> getDeviceMessage() {
		return deviceMessage;
	}


	public void setDeviceMessage(List<Device> deviceMessage) {
		this.deviceMessage = deviceMessage;
	}


	public int getAccount() {
		return account;
	}


	public void setAccount(int account) {
		this.account = account;
	}


	@Override
	public String execute() throws Exception {
		// TODO Auto-generated method stub
		DeviceManagementDao dmd = new DeviceManagementDao();
		Device device = new Device();
		device.setDId(DelID);
		if(dmd.DeleteDevice(device)){
			delSuccess=true;
		}else{
			delSuccess=false;
		}
		deviceMessage = dmd.getDevice(startpage);
		account = dmd.getcount();
		return "success";
	}

}
